package com.ytjj.bigdata.controller;

import com.ytjj.bigdata.model.dto.AdsPvCountDto;
import com.ytjj.bigdata.model.response.AdsTopicResponse;
import com.ytjj.bigdata.service.AdsPvCountService;
import com.ytjj.bigdata.service.AdsTopicService;
import com.ytjj.common.api.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/adsTopic")
public class AdsTopicController {
    @Resource
    private AdsTopicService adsTopicService;

    @GetMapping("/getTotalById")
    public AdsTopicResponse getTotalById(Integer id) {
        return adsTopicService.getTotalById(id);
    }

    /**
     * 根据话题Id获得今日话题pv
     * @returns: com.ytjj.qmyx.admin.model.db2.AdsTopicResponse
     * 
     */
    @GetMapping("/getTodayPv")
    public AdsTopicResponse getTodayPv(Integer id) {
        return adsTopicService.getTodayPv(id);
    }

    @PostMapping("/topList")
    public CommonResult topList() {
        return CommonResult.success(adsTopicService.getTopicsTop());
    }

    @GetMapping("/getTopicInfoAndPvById")
    public AdsTopicResponse getTopicInfoAndPvById(@RequestParam Integer id){
        return adsTopicService.getTopicInfoAndPvById(id);
    }
}
